﻿using strange.extensions.context.api;
using strange.extensions.dispatcher.eventdispatcher.api;
using strange.extensions.mediation.impl;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

namespace NormalBattleIoc
{
  

    public class PersonSelectEnemyMediator : Mediator
    {

        [Inject]
        public PersonSelectEnemyView view { get; set; }

        [Inject(ContextKeys.CONTEXT_DISPATCHER)]//全局的dispatcher
        public IEventDispatcher dispatcher { get; set; }

        /// <summary>
        /// 这里做初始化的操作，相当于start
        /// </summary>
        public override void OnRegister()
        {
            dispatcher.AddListener( PersonOperationEvent.Attack, onClickAttack);

            dispatcher.AddListener(TankOperationEvent.ZhuPaoAttack , onClickTankZhuPaoAttack );

            dispatcher.AddListener(BattleUIEvent.Close_All_Panel, OnCloseAll_Panel);
        }

        private void onClickTankZhuPaoAttack(IEvent payload)
        {
            view.ShowThisUI();
        }

        private void OnCloseAll_Panel(IEvent payload)
        {
            view.CloseThisUI();
        }

        private void onClickAttack(IEvent payload)
        {
            view.ShowThisUI();
        }

    


    }
}